import http from '@/common/http.js'
import qs from 'qs';

export async function wxLogin(data) { //登录
	return await http({
		url: '/apiuser/wxlogin',
		method: 'GET',
		data: data
	})
}
export async function getUserinfo() { //获取用户信息
	return await http({
		url: '/apiuser/user',
		method: 'GET'
	})
}
export async function queryTitle(data) { //全网搜索简称
	return await http({
		url: '/apiuser/queryTitle',
		method: 'GET',
		data: data
	})
}
export async function getBanners(data) { //获取banner图列表
	return await http({
		url: '/banner/getBanners',
		method: 'GET',
		data: data
	})
}
export async function getConfig() { //获取平台配置
	return await http({
		url: '/setting/list',
		method: 'GET'
	})
}

export async function updateUserinfo(data) { //修改用户信息
	return await http({
		url: '/apiuser/update',
		method: 'POST',
		data: data
	})
}
export async function getPhone(data) { //获取手机号
	return await http({
		url: '/apiuser/getphone',
		method: 'GET',
		data: data
	})
}
export async function getAddresslist() { //获取用户地址列表
	return await http({
		url: '/addr/list',
		method: 'GET'
	})
}
export async function saveAddress(data) { //用户新增地址
	return await http({
		url: '/addr/save',
		method: 'POST',
		data: data
	})
}
export async function delAddress(data) { //用户删除地址
	return await http({
		url: '/addr/delete/'+data.id,
		method: 'GET'
	})
}
export async function getUserinfobyid(data) { //通过ID获取用户信息
	return await http({
		url: '/apiuser/getuser/'+data.userId,
		method: 'GET'
	})
}
export async function getAddressdetail(data) { //根据地址ID获取信息
	return await http({
		url: '/addr/'+data.id,
		method: 'GET'
	})
}
export async function updateAddress(data) { //用户修改地址
	return await http({
		url: '/addr/update',
		method: 'POST',
		data: data
	})
}
export async function getdefAddr() { //获取用户默认地址
	return await http({
		url: '/addr/defAddr',
		method: 'GET'
	})
}
export async function rightsProtection() { //权益保障
	return await http({
		url: '/protocol/rightsProtection',
		method: 'GET'
	})
}
export async function getProtocolBycode(data) { //根据协议编号获取协议信息
	return await http({
		url: '/protocol/'+data.code,
		method: 'GET'
	})
}
export async function getCoupon(data) { //获取用户优惠券列表
	return await http({
		url: '/coupon/getCoupon/'+data.status,
		method: 'GET'
	})
}

export async function getActCouponList(data) { //获取活动优惠券列表
	return await http({
		url: '/coupon/getCouponList',
		method: 'GET',
		data
	})
}

export async function getCanuseCoupon(data) { //获取用户可用优惠券列表
	return await http({
		url: '/coupon/accord',
		method: 'GET',
		data: data
	})
}
export async function getDictdata(data) { //根据类型获取字典列表
	return await http({
		url: '/order/dict/'+data.dictType,
		method: 'GET'
	})
}
export async function userLike(data) { //用户分享点赞收藏
	return await http({
		url: '/apiuser/operation',
		method: 'POST',
		data: data
	})
}
export async function getUserlikes(data) { //查询用户收藏点赞信息列表
	return await http({
		url: '/apiuser/'+data.operation+'/'+data.busine,
		method: 'GET',
	})
}
export async function searchAllsite(data) { //全网搜索
	return await http({
		url: '/apiuser/query',
		method: 'GET',
		data: data
	})
}
export async function getNoticecount(data) { //获取消息未读数量
	return await http({
		url: '/notify/count',
		method: 'GET'
	})
}
export async function getNoticelist(data) { //根据分类获取消息列表
	return await http({
		url: '/notify/'+data.type,
		method: 'GET',
		data:{
			pageNum:data.pageNum,
			pageSize:data.pageSize
		}
	})
}
export async function getNoticeinfo(data) { //根据ID获取通知详情
	return await http({
		url: '/notify/get/'+data.id,
		method: 'GET'
	})
}

export async function addFeedback(data) { //用户意见反馈
	return await http({
		url: '/apiuser/feedback',
		method: 'POST',
		data: data
	})
}

// banner统计
export async function clickBanner(data) { //用户意见反馈
	return await http({
		url: '/banner/userClick',
		method: 'GET',
		data: data
	})
}

// 首页菜单列表
export async function getMenuList() { 
	return await http({
		url: '/api/diamond/list',
		method: 'GET',
	})
}